<?php
  header("content-type:text/html;charset=utf8");
  $name = $_POST['name'];
  $price = $_POST['price'];
  $descs = $_POST['descs'];

  $dsn = "mysql:host=localhost;dbname=demo;charset=utf8";
  $pdo = new PDO($dsn,'root','root');
  $sql = "INSERT book (name,price,descs) VALUES('$name','$price','$descs')";
  $res = $pdo->exec($sql);
  if($res){
  	echo "<script>alert('添加图书成功');location.href='lists.php'</script>";
  }


?>